﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using A14_Ex02_Adam_300604568_Chen_20131689.Properties;

public class ColumnNumberedButton : UserControl
{
    private event EventHandler ColumnNumberedButtonClick;

    public ColumnNumberedButton(int i_Index)
    {
        this.Name = string.Format("ColumnButton {0}", i_Index);
        this.TabIndex = i_Index;
        this.Anchor = AnchorStyles.Left | AnchorStyles.Top;
        int height = Resources.EmptyCell.Height;
        int width = Resources.EmptyCell.Width;
        this.Size = new Size(height, width);
        this.TabIndex = i_Index;
        this.initializeComponent();
    }

    private void initializeComponent()
    {
        this.SuspendLayout();
        //// 
        //// ColumnNumberedButton
        //// 
        this.Click += new System.EventHandler(this.ColumnNumberedButton_Click);
        this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.ColumnNumberedButton_MouseClick);
        this.ResumeLayout(false);
    }

    private void ColumnNumberedButton_Click(object sender, EventArgs e)
    {
        if (this.ColumnNumberedButtonClick != null)
        {
            this.ColumnNumberedButtonClick.Invoke(this, EventArgs.Empty);
        }
    }

    public override string ToString()
    {
        return this.TabIndex.ToString();
    }

    private void ColumnNumberedButton_MouseClick(object sender, MouseEventArgs e)
    {
        if (this.ColumnNumberedButtonClick != null)
        {
            this.ColumnNumberedButtonClick.Invoke(this, EventArgs.Empty);
        }
    }

    private void InitializeComponent()
    {
        this.SuspendLayout();
        // 
        // ColumnNumberedButton
        // 
        this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
        this.Margin = new System.Windows.Forms.Padding(0);
        this.Name = "ColumnNumberedButton";
        this.ResumeLayout(false);
    }
}